package cn.iocoder.yudao.module.member.dal.mysql.userpackage;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.userpackage.UserPackageDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.userpackage.vo.*;

/**
 * 用户关联套餐 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserPackageMapper extends BaseMapperX<UserPackageDO> {

    default PageResult<UserPackageDO> selectPage(UserPackagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserPackageDO>()
                .betweenIfPresent(UserPackageDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(UserPackageDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserPackageDO::getPackageId, reqVO.getPackageId())
                .eqIfPresent(UserPackageDO::getUsed, reqVO.getUsed())
                .betweenIfPresent(UserPackageDO::getUsedTime, reqVO.getUsedTime())
                .orderByDesc(UserPackageDO::getId));
    }

}